package com.acme;

import java.util.Date;

import com.acme.bankapp.domain.bank.*;
import com.acme.exceptions.ClientExistsException;
import com.acme.exceptions.ClientNumberException;

class BankApplication {
	public static void main(String[] args) {
		/* part 1 */
		ClientRegistrationListener[] listeners = {
			new ClientRegistrationListener(){
				public void onClientAdded(Client c) {
					System.out.println("Notification email for client " +
							c.getClientSalutation() +
							" to be sent");
				}
			}, new ClientRegistrationListener(){
				public void onClientAdded(Client c) {
					System.out.println(c.getClientSalutation());
				}
			}, new ClientRegistrationListener() {
				public void onClientAdded(Client c) {
					System.out.println(c.getClientSalutation() + " " + 
							(new Date()).toString());
				}
			}
		};
			
		Bank myBank = new Bank(listeners);
		try {
			myBank.addClient(new Client(new SavingsAccount(0),
					Gender.MALE,"Ivanov"));
		} catch (ClientExistsException | ClientNumberException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		/* part 2 */
		Account acc = new CheckingAccount(20, 10);
		System.out.println(acc.getBalance());
		acc.withdraw(50);
		System.out.println(acc.getBalance());
	}
	
}